import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router"
import Timer from "@renderer/components/Timer.vue"
import Stopwatch from "@renderer/components/Stopwatch.vue"
import Clock from "@renderer/components/Clock.vue"
import Setting from "@renderer/components/Setting.vue"
import TimerConfig from "@renderer/components/setting/TimerConfig.vue"
import AlarmClockConfig from "@renderer/components/setting/AlarmClockConfig.vue"

const routes:RouteRecordRaw[] = [
  {
    //设置缺省值，页面打开自动显示
    path: '/',
    redirect: '/timer'//重定向
  },{
    path: "/timer",
    component: Timer,
    children: [
      {
        path: "",
        redirect: {
          name: "clock"
        }
      },{
        path: "stopwatch",
        name: "stopwatch",
        component: Stopwatch
      },{
        path: "clock",
        name: "clock",
        component: Clock
      },
    ]
  },
  {
    path: "/setting",
    name: "setting",
    component: Setting,
    children: [
      {
        path: "timer_config",
        name: "timerConfig",
        component: TimerConfig
      },
      {
        path: "alarm_clock_config",
        name: "AlarmClockConfig",
        component: AlarmClockConfig
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
